package tj.eskhata.pos.domain;

// Generated 06.07.2010 15:48:41 by Hibernate Tools 3.3.0.GA

import java.math.BigDecimal;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Certificate generated by hbm2java
 */
@Entity
@Table(name = "CERTIFICATE", schema = "MTA")
public class Certificate implements DomainObject {

	private Long id;
	private CertType certType;
	private Long collectionId;
	private Long statusId;
	private Date dateV;
	private String who;
	private String docNum;
	private String seria;
	private Set<Client> clients = new HashSet<Client>(0);

	public Certificate() {
	}

	public Certificate(Long id) {
		this.id = id;
	}

	public Certificate(Long id, CertType certType,
			Long collectionId, Long statusId, Date dateV,
			String who, String docNum, String seria, Set<Client> clients) {
		this.id = id;
		this.certType = certType;
		this.collectionId = collectionId;
		this.statusId = statusId;
		this.dateV = dateV;
		this.who = who;
		this.docNum = docNum;
		this.seria = seria;
		this.clients = clients;
	}

	@Id
	@Column(name = "ID", unique = true, nullable = false, precision = 22, scale = 0)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "TYPE_DOC_ID")
	public CertType getCertType() {
		return this.certType;
	}

	public void setCertType(CertType certType) {
		this.certType = certType;
	}

	@Column(name = "COLLECTION_ID", precision = 22, scale = 0)
	public Long getCollectionId() {
		return this.collectionId;
	}

	public void setCollectionId(Long collectionId) {
		this.collectionId = collectionId;
	}

	@Column(name = "STATUS_ID", precision = 22, scale = 0)
	public Long getStatusId() {
		return this.statusId;
	}

	public void setStatusId(Long statusId) {
		this.statusId = statusId;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "DATE_V", length = 7)
	public Date getDateV() {
		return this.dateV;
	}

	public void setDateV(Date dateV) {
		this.dateV = dateV;
	}

	@Column(name = "WHO", length = 64)
	public String getWho() {
		return this.who;
	}

	public void setWho(String who) {
		this.who = who;
	}

	@Column(name = "DOC_NUM", length = 20)
	public String getDocNum() {
		return this.docNum;
	}

	public void setDocNum(String docNum) {
		this.docNum = docNum;
	}

	@Column(name = "SERIA", length = 5)
	public String getSeria() {
		return this.seria;
	}

	public void setSeria(String seria) {
		this.seria = seria;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "certificate")
	public Set<Client> getClients() {
		return this.clients;
	}

	public void setClients(Set<Client> clients) {
		this.clients = clients;
	}
	
	public void copy(Certificate c){
		this.setId(c.getId());
		this.setCertType(c.getCertType());
		this.setCollectionId(c.getCollectionId()); 
		this.setStatusId(c.getStatusId());
		this.setDateV(c.getDateV());
		this.setWho(c.getWho());
		this.setDocNum(c.getDocNum());
		this.setSeria(c.getSeria());		
	}

}
